Arrays

This topic describes the functions you use to manipulate array data.

Function Description and Example
length

Returns the number of items in a list.

The following example returns the number 3.

[1,2,3].length;
push

Adds an item to the end of a list.

The following example returns the list [1,2,3].

row = [1,2];
						row.push(3);
					return row;
pop

Removes an item from the end of a list and returns the item.

In the following example, the value of a is 3, and the value of b is [1,2].

row = [1,2,3];
						@.a = row.pop();
					@.b = row;
indexOf(searchObject)

Returns the position of the first character of the first occurrence of the search string. Returns -1 if the search string is not found. The first position is represented as 0.

The following example returns the number 1.

["a","b","c"].indexOf("b");
join(delimiter)

Returns a delimited string of items in the list.

The following example returns the string a and b and c.

["a","b","c"].join(" and ");
splice(start,len,newItem1,newItem2,...)

Removes n items beginning at the start position, where n=len. Then, inserts new items into the same position and returns the items that are removed. The first position is represented with 0.

In the following example, the value of a is [2,3], and the value of b is [1,0,0,4].

row = [1,2,3,4];
						@.a = row.splice(1,2,0,0);
					@.b = row;